﻿@using Huirui.Cavan.Domain.MainBoundedContext.CorporationModule
@model Huirui.Cavan.Presentation.Admin.ViewModel.ICorporationManagesViewModel
@{
    ViewBag.Title = "管理家政公司";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/Admin/Global/jquery.ui.all.css")"/>
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/Admin/Global/globaltopbomt.css")" />
}
<!--家政公司弹层-->
<div id="gsziliaoshenghedialog" title="审核">
    <div class="shenghemain">
        <input type="button" name="verify" id="pass" value="通过" class="managemouseOverStyle" />
        <input type="button" name="verify" id="fail" value="违规" class="managemouseOverStyle" />
    </div>
</div>
<div class="gl gs">
    <div class="glwz">
        管理家政公司</div>
    @using (Html.BeginForm())
    { 
        <div class="wzm">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="50%" style="padding-left: 20px;">
                        状<b style="margin-left: 8px; font-weight: normal;">态：</b>
                        @(Html.RadioButton("checkedStatus", "0", Model.SearchParam.CheckedStatus == 0 ? true : false))不限&nbsp;&nbsp;
                        @(Html.RadioButton("checkedStatus", CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode().ToString(), Model.SearchParam.CheckedStatus == CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode() ? true : false))等待审核&nbsp;&nbsp;
                        @(Html.RadioButton("checkedStatus", CorporationIdentifier.CheckedStatus.Passed.GetHashCode().ToString(), Model.SearchParam.CheckedStatus == CorporationIdentifier.CheckedStatus.Passed.GetHashCode() ? true : false))审核通过&nbsp;&nbsp;
                        @(Html.RadioButton("checkedStatus", CorporationIdentifier.CheckedStatus.Fail.GetHashCode().ToString(), Model.SearchParam.CheckedStatus == CorporationIdentifier.CheckedStatus.Fail.GetHashCode() ? true : false))违规&nbsp;&nbsp;
                        @Html.HiddenFor(a => a.SearchParam.CheckedStatus, new { name = "checkedStatus", id = "corporationCheckedStatus", value = Model.SearchParam.CheckedStatus.ToString() })
                    </td>
                    <td width="50%">
                        基本资料：
                        @(Html.RadioButton("infoCheckedStatus", "0", Model.SearchParam.InfoCheckedStatus == 0 ? true : false))不限&nbsp;&nbsp;
                        @(Html.RadioButton("infoCheckedStatus", CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode().ToString(), Model.SearchParam.InfoCheckedStatus == CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode() ? true : false))等待审核&nbsp;&nbsp;
                        @(Html.RadioButton("infoCheckedStatus", CorporationIdentifier.CheckedStatus.Passed.GetHashCode().ToString(), Model.SearchParam.InfoCheckedStatus == CorporationIdentifier.CheckedStatus.Passed.GetHashCode() ? true : false))审核通过&nbsp;&nbsp;
                        @(Html.RadioButton("infoCheckedStatus", CorporationIdentifier.CheckedStatus.Fail.GetHashCode().ToString(), Model.SearchParam.InfoCheckedStatus == CorporationIdentifier.CheckedStatus.Fail.GetHashCode() ? true : false))违规&nbsp;&nbsp;
                        @Html.HiddenFor(a => a.SearchParam.InfoCheckedStatus, new { name = "infoCheckedStatus", id = "corporationInfoCheckedStatus", value = Model.SearchParam.InfoCheckedStatus.ToString() })
                    </td>
                </tr>
                <tr>
                    <td style="padding-left: 20px;">
                        Logo：
                        @(Html.RadioButton("logoCheckedStatus", "0", Model.SearchParam.LogoCheckedStatus == 0 ? true : false))不限&nbsp;&nbsp;
                        @(Html.RadioButton("logoCheckedStatus", CorporationIdentifier.CheckedStatus.Unknow.GetHashCode().ToString(), Model.SearchParam.LogoCheckedStatus == CorporationIdentifier.CheckedStatus.Unknow.GetHashCode() ? true : false))未提交&nbsp;&nbsp;
                        @(Html.RadioButton("logoCheckedStatus", CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode().ToString(), Model.SearchParam.LogoCheckedStatus == CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode() ? true : false))等待审核&nbsp;&nbsp;
                        @(Html.RadioButton("logoCheckedStatus", CorporationIdentifier.CheckedStatus.Passed.GetHashCode().ToString(), Model.SearchParam.LogoCheckedStatus == CorporationIdentifier.CheckedStatus.Passed.GetHashCode() ? true : false))审核通过&nbsp;&nbsp;
                        @(Html.RadioButton("logoCheckedStatus", CorporationIdentifier.CheckedStatus.Fail.GetHashCode().ToString(), Model.SearchParam.LogoCheckedStatus == CorporationIdentifier.CheckedStatus.Fail.GetHashCode() ? true : false))违规&nbsp;&nbsp;
                        @Html.HiddenFor(a => a.SearchParam.LogoCheckedStatus, new { name = "logoCheckedStatus", id = "corporationLogoCheckedStatus", value = Model.SearchParam.LogoCheckedStatus.ToString() })
                    </td>
                    <td>
                        营业执照：
                        @(Html.RadioButton("businessLicenseCheckedStatus", "0", Model.SearchParam.BusinessLicenseCheckedStatus == 0 ? true : false))不限&nbsp;&nbsp;
                        @(Html.RadioButton("businessLicenseCheckedStatus", CorporationIdentifier.CheckedStatus.Unknow.GetHashCode().ToString(), Model.SearchParam.BusinessLicenseCheckedStatus == CorporationIdentifier.CheckedStatus.Unknow.GetHashCode() ? true : false))未提交&nbsp;&nbsp;
                        @(Html.RadioButton("businessLicenseCheckedStatus", CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode().ToString(), Model.SearchParam.BusinessLicenseCheckedStatus == CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode() ? true : false))等待审核&nbsp;&nbsp;
                        @(Html.RadioButton("businessLicenseCheckedStatus", CorporationIdentifier.CheckedStatus.Passed.GetHashCode().ToString(), Model.SearchParam.BusinessLicenseCheckedStatus == CorporationIdentifier.CheckedStatus.Passed.GetHashCode() ? true : false))审核通过&nbsp;&nbsp;
                        @(Html.RadioButton("businessLicenseCheckedStatus", CorporationIdentifier.CheckedStatus.Fail.GetHashCode().ToString(), Model.SearchParam.BusinessLicenseCheckedStatus == CorporationIdentifier.CheckedStatus.Fail.GetHashCode() ? true : false))违规&nbsp;&nbsp;
                        @Html.HiddenFor(a => a.SearchParam.BusinessLicenseCheckedStatus, new { name = "corporationBusinessLicenseCheckedStatus", id = "businessLicenseCheckedStatus", value = Model.SearchParam.BusinessLicenseCheckedStatus.ToString() })
                    </td>
                </tr>
                <tr>
                    <td style="padding-left: 20px;">
                        资<b style="margin-left: 8px; font-weight: normal;">质：</b>
                        @(Html.RadioButton("qualificationCheckedStatus", "0", Model.SearchParam.QualificationStatus == 0 ? true : false))不限&nbsp;&nbsp;
                        @(Html.RadioButton("qualificationCheckedStatus", CorporationIdentifier.CheckedStatus.Unknow.GetHashCode().ToString(), Model.SearchParam.QualificationStatus == CorporationIdentifier.CheckedStatus.Unknow.GetHashCode() ? true : false))未提交&nbsp;&nbsp;
                        @(Html.RadioButton("qualificationCheckedStatus", CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode().ToString(), Model.SearchParam.QualificationStatus == CorporationIdentifier.CheckedStatus.UnChecked.GetHashCode() ? true : false))等待审核&nbsp;&nbsp;
                        @(Html.RadioButton("qualificationCheckedStatus", CorporationIdentifier.CheckedStatus.Passed.GetHashCode().ToString(), Model.SearchParam.QualificationStatus == CorporationIdentifier.CheckedStatus.Passed.GetHashCode() ? true : false))审核通过&nbsp;&nbsp;
                        @(Html.RadioButton("qualificationCheckedStatus", CorporationIdentifier.CheckedStatus.Fail.GetHashCode().ToString(), Model.SearchParam.QualificationStatus == CorporationIdentifier.CheckedStatus.Fail.GetHashCode() ? true : false))违规&nbsp;&nbsp;
                        @Html.HiddenFor(a => a.SearchParam.QualificationStatus, new { name = "corporationQualificationCheckedStatus", id = "qualificationCheckedStatus", value = Model.SearchParam.QualificationStatus.ToString() })
                    </td>
                    <td style="text-align: left;">
                        显<b style="margin-left: 23px; font-weight: normal;">示：</b>
                        @(Html.RadioButton("onLineStatus", "0", Model.SearchParam.OnLineStatus == 0 ? true : false))不限&nbsp;&nbsp;
                        @(Html.RadioButton("onLineStatus", CorporationIdentifier.OnLineStatus.OnLine.GetHashCode().ToString(), Model.SearchParam.OnLineStatus == CorporationIdentifier.OnLineStatus.OnLine.GetHashCode() ? true : false))显示&nbsp;&nbsp;
                        @(Html.RadioButton("onLineStatus", CorporationIdentifier.OnLineStatus.OffLine.GetHashCode().ToString(), Model.SearchParam.OnLineStatus == CorporationIdentifier.OnLineStatus.OffLine.GetHashCode() ? true : false))过期&nbsp;&nbsp;
                        @Html.HiddenFor(a => a.SearchParam.OnLineStatus, new { name = "onLineStatus", id = "corporationOnLineStatus", value = Model.SearchParam.OnLineStatus.ToString() })
                    </td>
                </tr>
                <tr>
                    <td style="padding-left: 20px;">
                        编<b style="margin-left: 8px; font-weight: normal;">号：</b>
                        @Html.TextBoxFor(a => a.SearchParam.ID, new { name = "id", id = "id", @class = "texts" })
                    </td>
                    <td>
                        公<b style="margin-left: 6px; margin-right: 6px; font-weight: normal;">司</b>名：
                        @Html.TextBoxFor(a => a.SearchParam.FullName, new { name = "fullName", id = "fullName", @class = "texts" })&nbsp;
                        <input type="submit" name="button" id="button" class="sousuo" value="搜 索" />
                    </td>
                </tr>
            </table>
        </div>
        if (Model.Corporations.IsNotNull() && Model.Corporations.Count > 0)
        {
        <div style="display: block">
            <div class="wzlbs">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr style="background: #99FF99;">
                        <td width="7%" bgcolor="def5ff">
                            公司编号
                        </td>
                        <td bgcolor="def5ff">
                            公司名称
                        </td>
                        <td bgcolor="def5ff">
                            续期次数
                        </td>
                        <td width="10%" bgcolor="def5ff">
                            资料状态
                        </td>
                        <td width="10%" bgcolor="def5ff">
                            Logo状态
                        </td>
                        <td width="12%" bgcolor="def5ff">
                            营业执照状态
                        </td>
                        <td width="10%" bgcolor="def5ff">
                            资质状态
                        </td>
                        <td width="10%" bgcolor="def5ff">
                            显示状态
                        </td>
                        <td width="20%" bgcolor="def5ff">
                            操作
                        </td>
                    </tr>
                    @foreach (CorporationManageViewModel corporation in Model.Corporations)
                    {
                        <tr>
                            <td>
                                <div class="check">
                                    <div class="check_info">
                                        <span class="kong">@corporation.Item.ID</span></div>
                                    <div class="check_box">@Html.CheckBox("select", false, new { id = "select" + corporation.Item.ID.ToString() })</div>
                                </div>
                            </td>
                            <td width="14%">
                                @corporation.Item.FullName
                            </td>
                            <td width="9%">
                                @corporation.SubscribeServiceCount.ToString()
                            </td>
                            <td>
                                <span class="shtg">@corporation.BasicInfoCheckedStatus</span>
                            </td>
                            <td>
                                <span class="shtg">@corporation.LogoCheckedStatus</span>
                            </td>
                            <td>
                                <span class="shtg">@corporation.BusinessLicenseCheckedStatus</span>
                            </td>
                            <td>
                                <span class="wtj">@corporation.QualificationCheckedStatus</span>
                            </td>
                            <td>
                                <span class="wtj">@corporation.OnLineStatus</span>
                            </td>
                            <td>
                                <a href="#">查看</a>&nbsp;&nbsp;&nbsp;<a href="#">登录</a> &nbsp;&nbsp;&nbsp;<a href="#">管理服务</a>&nbsp;&nbsp;&nbsp;
                                <a href="#">特设</a>
                            </td>
                        </tr>
                    }
                </table>
            </div>
            <!---分页-->
            <div class="no_lists" id="pager" style="margin: 20px 0px 10px 0px; overflow: hidden;">
                <div class="gsshenhebtn" style="float: left;">
                    <input type="button" name="shenhe" id="gszlbtn" value="审核资料" class="managemouseOverStyle" />
                    <input type="button" name="shenhe" id="gslogobtn" value="审核logo" class="managemouseOverStyle" />
                    <input type="button" name="shenhe" id="gszzbtn" value="审核执照" class="managemouseOverStyle" />
                    <input type="button" name="shenhe" id="gszizhibtn" value="审核资质" class="managemouseOverStyle" />
                </div>
                <div style="float: right; width: 520px;margin-right:13px;">
                    @Html.Pager(@Model.SearchParam, new PagerOptions { PageIndexParameterName = "id", NavigationPagerItemWrapperFormatString = "<span class=\"qt\">{0}</span>", CurrentPagerItemWrapperFormatString = "<span class=\"cpb\">{0}</span>", NumericPagerItemWrapperFormatString = "<span class=\"item\">{0}</span>", CssClass = "pages", SeparatorHtml = "" }, "Default", null)
                    @Html.HiddenFor(a => a.SearchParam.CurrentPage, new { id = "currentPage", value = Model.SearchParam.CurrentPage.ToString() })
                </div>
            </div>
        </div>
        }
        else
        {
        <!---暂时没有管理家政公司信息-->
        <div style="display: block; border-bottom: 0px;" class="temporaryNoConter">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="46%" align="right">
                        <img src="../../../Images/Main/4.png" width="100" height="100" alt="" />
                    </td>
                    <td width="54%" align="left">
                        暂时没有管理家政公司信息哟!
                    </td>
                </tr>
            </table>
        </div>
        }
    }
</div>
@section scripts{
    @Scripts.Render("~/bundles/jqueryui")
    <script type="text/javascript">
        var selectedCorporation = 0;
        var business = "";
        $(function () {
            $("#pager a").bind("click", function () {
                $("#currentPage").val($(this).html());
                $("form[action^='/corporationmanage/list']").submit();
                return false;
            });

            $("input[name^='checkedStatus']").bind("click", function () {
                $("#corporationCheckedStatus").val($(this).val());
            });

            $("input[name^='infoCheckedStatus']").bind("click", function () {
                $("#corporationInfoCheckedStatus").val($(this).val());
            });

            $("input[name^='logoCheckedStatus']").bind("click", function () {
                $("#corporationLogoCheckedStatus").val($(this).val());
            });

            $("input[name^='businessLicenseCheckedStatus']").bind("click", function () {
                $("#corporationBusinessLicenseCheckedStatus").val($(this).val());
            });

            $("input[name^='qualificationCheckedStatus']").bind("click", function () {
                $("#corporationQualificationCheckedStatus").val($(this).val());
            });

            $("input[name^='onLineStatus']").bind("click", function () {
                $("#corporationOnLineStatus").val($(this).val());
            });

            $("input[name^='shenhe']").bind("click", function () {
                var mytitle = $(this).val();
                getBusiness(mytitle);
                $("#gsziliaoshenghedialog").dialog({ title: mytitle });
                $("#gsziliaoshenghedialog").dialog("open");
            });

            $("#gsziliaoshenghedialog").dialog({
                show: "blind",
                autoOpen: false
            });

            $("input[name^='verify']").bind("click", function () {
                var action = $(this).val();
                var postUrl = "/corporationmanage/" + business + "/" + selectedCorporation + "/";
                if (action == "通过") {
                    postUrl = postUrl + "2";
                }
                else {
                    postUrl = postUrl + "3";
                }

                $.ajax({
                    url: postUrl,
                    type: 'POST',
                    success: function (data) {
                        if (data) {
                            if (data.IsSuccess) {
                                alert(data.Messages[0]);
                                $("#gsziliaoshenghedialog").dialog("close");
                            }
                        }
                    },
                    error: function () {
                        alert("系统忙，请稍候再试");
                    }
                });
            });

            $("input[name^='select']").bind("click", function () {
                selectedCorporation = $(this).attr("id").substring("select".length);
            });

            function getBusiness(title) {
                if (title == "审核资料") {
                    business = "checkinfo";
                }
                else if (title == "审核logo") {
                    business = "checklogo";
                }
                else if (title == "审核执照") {
                    business = "checkbl";
                }
                else if (title == "审核资质") {
                    business = "checkql";
                }
            }
        });
    </script>
}
